;; 分数和实数运算测试

;; 测试分数运算
(display "==== 分数运算测试 ====")
(newline)

(display "(/ 1 2) => ")
(display (/ 1 2))
(newline)

(display "(+ (/ 1 2) (/ 1 2)) => ")
(display (+ (/ 1 2) (/ 1 2)))
(newline)

(display "(- (/ 3 4) (/ 1 4)) => ")
(display (- (/ 3 4) (/ 1 4)))
(newline)

(display "(* (/ 2 3) (/ 3 4)) => ")
(display (* (/ 2 3) (/ 3 4)))
(newline)

(display "(/ (/ 1 2) (/ 1 4)) => ")
(display (/ (/ 1 2) (/ 1 4)))
(newline)

(display "(/ 5 2) => ")
(display (/ 5 2))
(newline)

;; 测试实数运算
(display "\n==== 实数运算测试 ====")
(newline)

(display "(exact->inexact (/ 1 2)) => ")
(display (exact->inexact (/ 1 2)))
(newline)

(display "(+ 1.5 2.5) => ")
(display (+ 1.5 2.5))
(newline)

(display "(- 5.5 2.2) => ")
(display (- 5.5 2.2))
(newline)

(display "(* 2.5 4.0) => ")
(display (* 2.5 4.0))
(newline)

(display "(/ 10.0 4.0) => ")
(display (/ 10.0 4.0))
(newline)

;; 测试分数相关内置函数
(display "\n==== 分数相关内置函数测试 ====")
(newline)

(display "(numerator (/ 3 4)) => ")
(display (numerator (/ 3 4)))
(newline)

(display "(denominator (/ 3 4)) => ")
(display (denominator (/ 3 4)))
(newline)

(display "(numerator 5) => ")
(display (numerator 5))
(newline)

(display "(denominator 5) => ")
(display (denominator 5))
(newline)

(display "(exact->inexact 3) => ")
(display (exact->inexact 3))
(newline)

(display "(inexact->exact 3.0) => ")
(display (inexact->exact 3.0))
(newline)

;; 测试数值转换函数
(display "\n==== 数值转换函数测试 ====")
(newline)

(display "(floor (/ 5 2)) => ")
(display (floor (/ 5 2)))
(newline)

(display "(floor (/ -5 2)) => ")
(display (floor (/ -5 2)))
(newline)

(display "(ceiling (/ 5 2)) => ")
(display (ceiling (/ 5 2)))
(newline)

(display "(ceiling (/ -5 2)) => ")
(display (ceiling (/ -5 2)))
(newline)

(display "(truncate (/ 5 2)) => ")
(display (truncate (/ 5 2)))
(newline)

(display "(truncate (/ -5 2)) => ")
(display (truncate (/ -5 2)))
(newline)

(display "(round (/ 5 2)) => ")
(display (round (/ 5 2)))
(newline)

(display "(round (/ 7 2)) => ")
(display (round (/ 7 2)))
(newline)

(display "(round (/ -5 2)) => ")
(display (round (/ -5 2)))
(newline)

;; 测试混合运算
(display "\n==== 混合运算测试 ====")
(newline)

(display "(+ 1 (/ 1 2)) => ")
(display (+ 1 (/ 1 2)))
(newline)

(display "(* 2 (/ 3 4)) => ")
(display (* 2 (/ 3 4)))
(newline)

(display "(+ (/ 1 2) 1.5) => ")
(display (+ (/ 1 2) 1.5))
(newline)

(display "(* 2.0 (/ 3 4)) => ")
(display (* 2.0 (/ 3 4)))
(newline)

;; 测试比较操作
(display "\n==== 比较操作测试 ====")
(newline)

(display "(= (/ 1 2) (/ 2 4)) => ")
(display (= (/ 1 2) (/ 2 4)))
(newline)

(display "(< (/ 1 2) (/ 3 4)) => ")
(display (< (/ 1 2) (/ 3 4)))
(newline)

(display "(> (/ 5 2) 2) => ")
(display (> (/ 5 2) 2))
(newline)

(display "(= (/ 1 2) 0.5) => ")
(display (= (/ 1 2) 0.5))
(newline)

(display "(eqv? (/ 1 2) (/ 1 2)) => ")
(display (eqv? (/ 1 2) (/ 1 2)))
(newline)

(display "(equal? (/ 1 2) 0.5) => ")
(display (equal? (/ 1 2) 0.5))
(newline)